package main

import (
	"duplicateMyDB/internal/command"
	"duplicateMyDB/internal/logger"
	"log"

	"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
	Use:   "dupdb",
	Short: "Duplicate database",
	Run:   func(cmd *cobra.Command, args []string) {},
}

func init() {
	if err := logger.NewLogger("dupdb"); err != nil {
		log.Fatalf("Failed to initialize logger: %v", err)
	}
}

func main() {
	rootCmd.AddCommand(command.ShowCmd)
	rootCmd.AddCommand(command.DuplicateCmd)
	rootCmd.AddCommand(command.VersionCmd)
	rootCmd.AddCommand(command.RestoreCmd)
	rootCmd.AddCommand(command.BackupCmd)

	if err := rootCmd.Execute(); err != nil {
		logger.Errorf("Failed to execute command: %v", err)
	}
}
